<?php
class Cts_Db_Equipment extends Cts_Db_Table
{
    protected $_name = 'cts_equipment' ;
    protected $_primary = 'id' ;
    
    public function getList( $strLocator , $nStart = NULL , $nLimit = NULL )
    {
        $this->_select = $this->_db->select();
    	$this->_select->limit ( $nLimit , $nStart ) ;
    	$this->_select->from( $this->_name, '*' )
    	              ->joinleft( 'cts_compact' , 'cts_compact.id = cts_equipment.compact_id' , array( 'compact_sn' => 'serial_number' , 'compact_name' => 'name' ) )
    	              ->joinleft( 'cts_manufacturer' , 'cts_manufacturer.id = cts_equipment.manufacturer_id' , array( 'manufacturer_name' => 'name' , 'service_number' ) )
			          ->where( $strLocator )
    	              ->order( 'id asc' ) ;
        $sql = $this->_select->__toString( ) ;
        //echo $sql ;
        $result = $this->_db->fetchAll( $sql ) ;
        return $result ; 
    }
}